JavaScript

A5.u.arrayinclude Method

Syntax

A5.u.array.include(array,item[,index])

Arguments

arrayarray

The array to include the item in.

itemany

The item to include in the array.

indexnumber

The index to insert the item at if it is unique. A negative value will be offset from the end of the array with "-1" being the last index.

Returns

includedboolean

Is "true" is the item was added to the array.

Description

Include an item in the array if the new item is unique.

Example

var a = [1,2,4,5,7,8];
var included = A5.u.array.include(a,3,1);
// a = [1,3,2,4,5,7,8]
// included = true
included = A5.u.array.include(a,2);
// included = false